package com.shunda.ysdgj.common.exception;

import com.shunda.ysdgj.model.vo.ResultVo;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(CustomException.class)
    public ResultVo customException(CustomException e) {
        return ResultVo.build(e.getResultCode());
    }

    @ExceptionHandler(Exception.class)
    public ResultVo otherException(Exception e) {
        return ResultVo.build(100, e.getMessage());
    }
}
